{% extends 'base.html' %}
{% block content %}
<h2>我的比赛赛程</h2>
{% if matches %}
<table class="table">
    <thead>
        <tr>
            <th>组别</th>
            <th>小组</th>
            <th>轮次</th>
            <th>对手</th>
            <th>球台编号</th>
            <th>比赛时间</th>
            <th>结果</th>
        </tr>
    </thead>
    <tbody>
    {% for match in matches %}
        <tr>
            <td>{{ match.group }}</td>
            <td>{{ match.subgroup or '-' }}</td>
            <td>{{ match.round }}</td>
            <td>
                {% if match.player_a_id == current_user.id %}
                    {{ match.player_b.real_name or match.player_b.username }}
                {% else %}
                    {{ match.player_a.real_name or match.player_a.username }}
                {% endif %}
            </td>
            <td>{{ match.table_id or '-' }}</td>
            <td>{{ match.match_time or '-' }}</td>
            <td>{{ match.result or '-' }}</td>
        </tr>
    {% endfor %}
    </tbody>
</table>
{% else %}
<div class="alert alert-info">暂无赛程信息</div>
{% endif %}
<a href="{{ url_for('student_reservations.monthly_competition_detail', comp_id=request.view_args.comp_id) }}" class="btn btn-secondary">返回比赛详情</a>
{% endblock %}
